<%-- 
    Document   : main
    Created on : 25/09/2010, 12:22:20 PM
    Author     : scott
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<jsp:useBean id="accounts" class="java.util.Map" scope="session"/>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SwinBank - Main</title>
    </head>
    <body>
        <h1>Welcome to SwinBank</h1>
        <hr />
        <div id="message" style="color: red;"><%= (session.getAttribute("mainMessage") != null) ? session.getAttribute("mainMessage") : "" %></div>
        <p>Your accounts:</p>
        <%--
            Loop over accounts here and add table rows to the table below
        ${customer.getAccountIds(session.getAttribute("customerId"))}
        --%>
        <table border="1">
            <tr><th>Account</th><th>Balance</th><th>View History</th></tr>
            <c:forEach var="account" items="${accounts}">
                <tr><td><c:out value="${account.key}"/></td><td>$<c:out value="${account.value}"/></td><td><a href="selectDates?accountHistoryId=${account.key}">History</a></td></tr>
            </c:forEach>
        </table>
        <p>Actions:</p>
        <ul>
            <li><a href="transferFunds">Transfer Funds</a></li>
            <li><a href="selectBill">Bill Payment</a></li>
        </ul>
        <%--
            Call the logout function of the servlet here
        --%>
        <a href="logout" title="Logout of SwinBank">Logout</a>
    </body>
</html>
